/*  
	Author      : Sidek Sirun
	Course      : UCI Java Programming I (X460.10)
	Assignment 4: Loop Collection

	Create a collection with 100 numbers. Next, loop through the Collection and write 
	out numbers that are divisible by 3.
*/

import java.util.ArrayList;

class LoopCollection {
	/**
	* @main() method
	*/
	public static void main(String[] args) {
		// New number collection
		ArrayList<Integer> numberColl = new ArrayList<Integer>();
		int div = 3;
		int rem = 0;

		// Populate collection with number
		for (int i = 1000; i < 1100; i++) {
			numberColl.add(i);
		}

		System.out.println("");
		System.out.println("Collection content:");
		System.out.println(numberColl);
		System.out.println("");
		System.out.println("No. of object in collection: " + numberColl.size());

		System.out.println("");
		// Number in the collection must be divisible by 3
			for (int j = 0; j < numberColl.size(); j++) {
				rem = numberColl.get(j) % 3;
				//System.out.println("Remainder of " + numberColl.get(j) + "/" + div + " = " + rem);
				if ( rem == 0) {
					System.out.println(numberColl.get(j) + " is divisible by " + div);
				}
			}

		System.out.println("");
	}

}
